<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=3,minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
	<title>账户管理</title>
	<link href="css/public/reset-html5.css" rel="stylesheet">
	<link href="css/public/mui.min.css" rel="stylesheet">
	<link href="css/wx-main.css?20161028_1" rel="stylesheet">
	<link rel="stylesheet" href="css/orderlist.css">
	<link rel="stylesheet" href="css/admin.css">
	<style>
		.a_item{
			display:flex;
			align-items: center;
		}
		.a_date{
			flex:1;
			padding:10px 15px;
		}
		.price{
			width:80px;
			text-align: right;
			padding-right:15px;
			color:#ff9800;
		}
		.price:after{
			content:" 元";
		}
		.price_2:before{
			content:"-";
		}
		.price:before{
			content:"+";
		}
		.tixian_status0:before{
			content:"(审核中)";
		}
		.tixian_status1:before{
			content:"(已打款)";
		}
		.detail_type1:before{
			content:"订单收入";
			font-size:1.1em;
		}
		.detail_type2:before{
			content:"提现操作";
			font-size:1.1em;
		}
	</style>
</head>
<body id="main">

<div class="mui-card money">
	<div class="pane">
		<div>账户余额</div>
		<div v-text="accountDetail.m_money"></div>
	</div>
	<div class="pane">
		<div>可提现金额</div>
		<div v-text="accountDetail.available_money"></div>
	</div>
	<button onclick="location.href='withdraw.html'">提现</button>
</div>

<div>
	<div class="primary-text pad status" style="font-size: 17px">
		<span>账户明细</span>
		<select id="status" v-model="status" v-on:change="change();">
			<option value="0">全部记录</option>
			<option value="1">收入</option>
			<option value="2">支出</option>
		</select>
	</div>
	
	<div class="mui-card" v-show="order_list.length==0">
		<div class="mui-card-content">
			<div class="mui-card-content-inner">暂无流水	</div>
		</div>
	</div>
	
	<div class="mui-card" v-for="w in accountDetail.account_details" v-on:click="go_order_info(list.order_id)">
		<div class="a_item">
			<div class="a_date">
				<div style="color:#999;" v-text="w.a_date"></div>
				<div class="detail_type{{w.a_status}}"><span style="color:#999;" v-text="w.order_num"></span></div>
			</div>
			<div>
				<div class="price price_{{w.a_status}}" v-text="w.a_money"></div>
				<div v-if="w.a_status==2" class="tixian_status{{w.a_audit_status}}"></div>
			</div>
		</div>
	</div>
	
	<button v-on:click="loadMore();" v-if="showLoadMore">加载更多</button>
</div>
</body>
<script src="../js/jquery-2.2.1.min.js"></script>
<script src="../plugins/vue/vue.min.js"></script>
<script src="js/phone.js"></script>
<script src="js/public.js"></script>
<script src="layer_mobile/layer.js"></script>
<script>
	var vue = new Vue({
		el: "#main",
		data: {
			accountDetail:null,
			status:0,
			page:0,
			showLoadMore:true
		},
		methods: {
			/*加载师傅账号详情*/
			loadAccountData:function(){
				var thiz = this;
				var index = layer.open({type: 2,shadeClose:false});
				$.get(apiRecycle+"partner.php/Admin/AccountDetails/account_admin", {
					status:thiz.status,
					offset:thiz.page*20,
					limit:20
				}, function(res){
					vue.accountDetail = res.data;
					layer.close(index);
					thiz.page+=1;
				}, "json");
			},
			
			change:function(){
				var thiz = this;
				thiz.page = 0;
				thiz.loadAccountData();
			},
			
			loadMore:function(){
				var thiz = this;
				var index = layer.open({type: 2,shadeClose:false});
				$.get(apiRecycle+"partner.php/Admin/AccountDetails/account_admin", {
					status:thiz.status,
					offset:thiz.page*20,
					limit:20
				}, function(res){
					if(!res.data.account_details || res.data.account_details.length==0){
						thiz.showLoadMore = false;
					}
					vue.accountDetail.account_details = vue.accountDetail.account_details.concat(res.data.account_details);
					layer.close(index);
					thiz.page+=1;
				}, "json");
			}
		},
		ready: function () {
			this.loadAccountData();
		}
	});
</script>
</html>